package com.nbsaas.boot.cms.rest.resource;

import com.nbsaas.boot.cms.api.apis.NavigationApi;
import com.nbsaas.boot.cms.data.entity.Navigation;
import com.nbsaas.boot.cms.api.domain.request.NavigationRequest;
import com.nbsaas.boot.cms.api.domain.response.NavigationResponse;
import com.nbsaas.boot.cms.api.domain.simple.NavigationSimple;
import com.nbsaas.boot.cms.rest.convert.NavigationSimpleConvert;
import com.nbsaas.boot.cms.rest.convert.NavigationEntityConvert;
import com.nbsaas.boot.cms.rest.convert.NavigationResponseConvert;
import com.nbsaas.boot.cms.data.repository.NavigationRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   导航菜单-业务接口实现
*/
@Transactional
@Service
public class NavigationResource extends BaseResource<Navigation,NavigationResponse, NavigationSimple, NavigationRequest>  implements NavigationApi {

    @Resource
    private NavigationRepository navigationRepository;

    @Override
    public JpaRepositoryImplementation<Navigation, Serializable> getJpaRepository() {
        return navigationRepository;
    }

    @Override
    public Function<Navigation, NavigationSimple> getConvertSimple() {
        return new NavigationSimpleConvert();
    }

    @Override
    public Function<NavigationRequest, Navigation> getConvertForm() {
        return new NavigationEntityConvert();
    }

    @Override
    public Function<Navigation, NavigationResponse> getConvertResponse() {
        return new NavigationResponseConvert();
    }




}


